package com.wolf.cx330.utils.act

import android.content.Context
import android.content.Intent
import android.graphics.BitmapFactory
import android.os.Bundle
import android.os.Environment
import androidx.appcompat.app.AppCompatActivity
import com.wolf.cx330.R
import com.wolf.cx330.utils.AppUtils
import java.io.File
import java.util.*


class CompressAct : AppCompatActivity() {

    companion object {
        fun actionStart(context: Context) {
            context.startActivity(Intent(context, CompressAct::class.java))
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_compress)
        //  bitmap 压缩
        val bitmap = BitmapFactory.decodeResource(resources, R.drawable.ic_compress)
        //
        println("【IM】CompressAct  onCreate:getExternalStorageDirectory =  ${Environment.getExternalStorageDirectory().path}")
        val path = "/sdcard/icbc_temp_pic/pic_${UUID.randomUUID().toString().replace("-", "")}.jpg"
        AppUtils.saveBitmap(path,bitmap)
        println("【IM】CompressAct  onCreate:原有BitmapSize = ${File(path).length()}")

    }
}